from flask import current_app, jsonify
from flask import render_template
from flask import session

from info.models import User
from info.utils.response_code import RET
from . import user_blue


@user_blue.route('/')
def userindex():
    user = None
    user_id = session['user_id']
    try:
        user = User.query.get(user_id)
    except Exception as e:
        current_app.logger.error(e)
        return jsonify(error = RET.DBERR,errmsg = '获取用户对象失败')
    
    return render_template('news/user.html')